package cn.txm.pay.alipayconfig;

import java.io.FileWriter;
import java.io.IOException;

/**
 * 支付宝的配置常量
 * @author Administrator
 * @version 1.0
 * @date 2021/1/22 11:53
 */
public class AlipayConfig {
    //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000117603959";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQClFnFa7vol2YvTv7MsnGY2AJtKJXcqxD1oSD+IE/aEDpSO2lzxJp12I8MJENB95rUsAn6SuoXj98HX0IT+jKzlXOP5fFLTNgAnMjKvt8N8wm1zmzsz8X0HJlVtzTodB5mqXVtw6V3wnUw3H0dxWVd7vliw83IP5UfgUFsM/rCrs3ncUe/ng0SJncDsZWcbsaBPLk+woVVQRfPy0j92gnAzNfMJBq+mkfHnQU2ToNruhEKu6MRrr2gFUOGfHVMoIgWDX0TjTgRItnmF9eK6jOtTk7uqpextp31Q3nQ+BWPhQ7LQlzDywKfidKWHB9a7b4mgCcm9s8Sm4S5ynKtEONHLAgMBAAECggEALIp7lv83OpMRaNYl73lbEmLjgwPMvRspPkOP8JUCQ+rzJf/AZ8f1X/SSIJYKyo0+gFtD7y6oBTPJdwLpfwxRcai4UY27gwTk0a53gnVgJv8GLNTLCl6zTwSGtBNVBJQSX6bEjxhHoi2ubIjh67EhK1/V6hgkxCkmVV0Y0867t/dLU+h5Cpo+8qb/RdIB5icWDvbSvRtscCXFeElXDCxsv2oupTqWbcjccwUvPISeQXetsYK+aHHmKWwot8UU11//rPE0iSn3GJlFI2w3YxsjZxdHdO3sbI4g8mSBB9Jd8ISifbuUwRwv55a8Y3E3zaxK3RfsSySMzml7gng3pID5AQKBgQDbgVuSQGCUGjttK5+wTpL1vqpgyvJsvB5/lDwYNejP1exb7E4DEOa2QGinGKff2DMI3V4jY9/eG1met70lhXjyLuCPYrddNkpQ+2czMT1iSh3foTY8B4N+4Qv1a+3gyOnntLmw6Af7JVSXHCvPS+gvqatOAfYK/+MwrOvcu1waCwKBgQDAiPKHpweuBMw/0ceofqJ/+DGsakyjcCE8DJmyEw9ZIo0dY8L1X+hp5WzuJpjOhcyA8jn83JqZLv4I9sEVzEl5/pHbQW2eQtxPCu28jCQJOMsn7XHewCgkTb+9gXVGa2NkZYc7sho2fFdkPYyORVajwEv9RF9M6JouXHCF2Di/QQKBgHK1Pu1GxzGeI8ABNAomhZX2dYLvi5BXHnj9NgpQ4cD6wfGno3zmsCo9rnLj55aKnODdDfzgjHS9RjAzRJz/Cx1EcgV8SOZlIKEBQAT4jmN25/WdgYINSyJa6KzwIfd+Bv4W65MPLlyIPZRaHGrP+B4wRF0XmURWRJuDQh6vqonRAoGAeP2Wa2iris+5CuHpdhkeRQzTKmYigxKT0AibDSytGHZ991oZydjbVLC4I3Bd1mp+eQm/Jwf6nwjI2xk1fV1DT0aKoh4bpLifeYyEmVf3zVPDVvP/+tsGXsn9FDmmWPpjG1QyB3GEx3ib8oI7MayhJYZSOnYc7Ve+jCPLElEuWAECgYEAxfiZ1CQbHBeW1+ai8npSzBez3SQLMTqSA04uS8E/c0DMkqNugctWk/A8PVgQeNJusH5qThlafyd1kUirIfLbheuOZuDBv5NcaxE1VIaiJbEz7VLqyC3KJPZoOT6ww9LvErLMEnghlYWK1WXTMOzWvM9gmd9kIAwmg4eDrLQGeqs=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmUJoPCT40EtMsKx/dZMVCwj4cEWKqAg3mfIASUryVtM54plAg3HqTMH8OWx8WVOveLKE6fo4L32+y8gteWS+1+9S2jvNOD2rexMP/X26qlpGuUaqZWz/aAPIMyHAZTJVebKkC4dONV9Yg2hHQyQmxjYqSvGv0Nt9Ohx2jfINYC8niGxX5KFQner+IK/TPtM87okMelUvEW4n2ywRPZvPqyX9oVpz6B9sIj9pw81Yum1BjFUmh5fsCbSk6yWaI9qJ7r7hn12VDj+wT9YjKMR+ZfhNfoVp21YueTCtnZsANqjQChkY/oNXehxeV2r4c9JorGzt28HgltmpytkKt/C3PQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://4cuwtp.natappfree.cc/alipay/notify";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost/success.html";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 数据格式
    public static String format = "JSON";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";

    //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
